#ifndef SYMBOLTABLE_H
#define SYMBOLTABLE_H

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/*
	 yes, I implemented the symbol table as a linked list. don't like it? 
	 change it. make a hash table. if I ever have to assemble large files 
	 with lots of symbols, I'll make a hash table myself. 
*/
enum section
{
	S_TEXT, S_DATA
};
enum access
{
	S_LOCAL, S_GLOBAL
};

struct symbol
{
	char name [32];
	int address;
	enum section section;
	enum access access;
	struct symbol *next;
};

struct symbol *lookup_by_name (struct symbol *table, char *name);
struct symbol *insert (struct symbol *table, char *name, int address, enum section section, enum access access);
struct symbol *new (char *name, int address, enum section section, enum access access);
void print_table (struct symbol *table);
struct symbol *destroy (struct symbol *table);
#endif

